<include file="header" />
<div class="wraper" js="wapjs/meeting/js/outdoor">
    <div class="head clearfix">
        <!--<a href="/meeting/MeetingService/index/account_id/{BEESCRM:$accountId}/status/1" class="iconfont icon-zuo"></a>-->
        <a href="/meeting/Meeting/ucenter/account_id/{BEESCRM:$accountId}" class="iconfont icon-zuo"></a>
        <span class="head-name">会议服务管理</span>
    </div>
    <div class="tab clearfix">
        <a href="/meeting/MeetingService/index/account_id/{BEESCRM:$accountId}/status/1" class="tab-list <if condition='$status eq 1'>visited</if>">未执行</a>
        <a href="/meeting/MeetingService/index/account_id/{BEESCRM:$accountId}/status/2" class="tab-list <if condition='$status eq 2'>visited</if>">已执行</a>
    </div>
    <div class="search-box box-center">
        <input name="meeting_name" placeholder="搜索会议室" class="search">
        <span class="iconfont icon-sousuo text-green"></span>
        <select name="select_date" id="select_date">
            <option value="0">查看全部</option>
            <option value="1">当天</option>
            <option value="2">未来三天</option>
            <option value="3">未来一周</option>
        </select>
        <div class="triangle2"></div>
    </div>

    <!--无记录-->
    <empty name="data">
        <div class="norecord">
            <img src="/assets/meeting/images/wuhuichang.png"/>
            <p class="text-gray">暂无活动预约</p>
        </div>
    <else />
        <div class="lists">
            <if condition="$status eq 1">
                <div class="list-line text-gray">总计{BEESCRM:$meetingCount}场会议待准备</div>
            </if>
            <div id="scrollList">
                <volist name="data" id="vo">
                <if condition="$status eq 1">
                <a href="/meeting/MeetingService/detail/account_id/{BEESCRM:$accountId}/basic_id/{BEESCRM:$vo.basic_id}" class="list-line">
                    <div class="tb-mode">
                        <div class="tb-cell lineheight2">{BEESCRM:$vo.room_name}</div>
                        <div class="tb-cell text-right" style="width: 100px;">
                            <p>{BEESCRM:$vo.start_time|date='m月d日',###}/{BEESCRM:$vo.weekday}</p>
                            <p>{BEESCRM:$vo.start_time|date='H:i',###}-{BEESCRM:$vo.end_time|date='H:i',###}</p>
                        </div>
                        <div class="tb-cell text-right" style="width: 28px;"><span class="iconfont icon-you"></span></div>
                    </div>
                </a>
                <elseif condition="$status eq 2"/>
                <a href="javascript:void(0)" class="list-line detail" data-basic_id="{BEESCRM:$vo.basic_id}">
                    <div class="tb-mode">
                        <div class="tb-cell lineheight2">{BEESCRM:$vo.room_name}</div>
                        <div class="tb-cell text-right" style="width: 100px;">
                            <p>{BEESCRM:$vo.start_time|date='m月d日',###}/{BEESCRM:$vo.weekday}</p>
                            <p>{BEESCRM:$vo.start_time|date='H:i',###}-{BEESCRM:$vo.end_time|date='H:i',###}</p>
                        </div>
                        <div class="tb-cell text-right" style="width: 28px;"><span class="iconfont icon-you"></span></div>
                    </div>
                    <div class="detailmsg text-12">
                    </div>
                </a>
                </if>
            </volist>
            </div>
        </div>
    </empty>
</div>
<input type="hidden" id="status" name="status" value="{BEESCRM:$status}" />
<script type="text/javascript" src="/assets/public/seajs/sea.js"></script>
<script enter="publicjs/public" id="confnode" async="async" src="/assets/public/config.js"></script>
<script type="text/javascript" src="/assets/public/jquery-2.1.0.min.js"></script>
<script type="text/javascript">

    //按日期搜索
    $("#select_date").change(function () {
        var select_date = $(this).val();
        var status = $("#status").val();
        $.ajax({
            url : '/meeting/MeetingService/doSearchByDate/account_id/' + '{BEESCRM:$accountId}' + '/status/' + status,
            type : 'post',
            data : {select_date : select_date},
            dataType : 'json',
            success : function (result) {
                var html = '';
                if(result.status == 'S') {
                    if (status == 1) {
                        //未执行
                        if (result.message) {
                            $.each(result.message, function (key, value) {
                                html += '<a href="/meeting/MeetingService/detail/account_id/{BEESCRM:$accountId}/basic_id/{BEESCRM:$vo.basic_id}" class="list-line"> ' +
                                        '<div class="tb-mode"> ' +
                                        '<div class="tb-cell lineheight2">' + value.room_name + '</div> ' +
                                        '<div class="tb-cell text-right" style="width: 100px;"> ' +
                                        '<p>' + value.date + ' / ' + value.weekday + '</p> ' +
                                        '<p>' + value.start_time + '-' + value.end_time + '</p> ' +
                                        '</div> ' +
                                        '<div class="tb-cell text-right" style="width: 28px;"><span class="iconfont icon-you"></span></div> ' +
                                        '</div> ' +
                                        '</a>';
                            })
                        }
                    } else if (status == 2) {
                        //已执行
                        if(result.message){
                            $.each(result.message, function (key, value) {
                                html += '<a href="javascript:void(0)" class="list-line detail" data-basic_id="{BEESCRM:$vo.basic_id}"> ' +
                                        '<div class="tb-mode"> ' +
                                        '<div class="tb-cell lineheight2">'+ value.room_name +'</div> ' +
                                        '<div class="tb-cell text-right" style="width: 100px;"> ' +
                                        '<p>'+ value.date + ' / ' + value.weekday + '</p> ' +
                                        '<p>' + value.start_time + '-' + value.end_time + '</p> ' +
                                        '</div> ' +
                                        '<div class="tb-cell text-right" style="width: 28px;"><span class="iconfont icon-you"></span></div> ' +
                                        '</div> ' +
                                        '<div class="detailmsg text-12"> ' +
                                        '</div> ' +
                                        '</a>';
                            })
                        }
                    }
                }else if (result.status == 'F') {

                }
                $("#scrollList").html(html);
            }
        });
    })

    $(".search").bind('input propertychange', function () {
        var room_name = $(this).val();
        var status = $("#status").val();
        var html = '';

        $.ajax({
            url : '/meeting/MeetingService/getRoomByRoomName/account_id/' + '{BEESCRM:$accountId}' + '/status/' + status,
            type : 'post',
            data : {room_name : room_name},
            dataType : 'json',
            success : function (result) {
                if(result.status == 'S'){
                    var room = result.message;
                    if(!room) {
                        html = '<div class="norecord"> <img src="/assets/meeting/images/nomeeting.png"/> <p class="text-gray">无相关会议室</p> </div>';
                    }else{
                        $("#scrollList").empty();
                        $.each(room, function (key,val) {
                            html += '<a href="/meeting/MeetingService/detail/account_id/{BEESCRM:$accountId}/basic_id/{BEESCRM:$vo.basic_id}" class="list-line"> ' +
                                    '<div class="tb-mode"> ' +
                                    '<div class="tb-cell lineheight2">'+ val.room_name +'</div> ' +
                                    '<div class="tb-cell text-right" style="width: 100px;"> ' +
                                    '<p>'+ val.date + '/' + val.weekday +'</p> ' +
                                    '<p>'+ val.start_time + ' - ' + val.end_time +'</p> ' +
                                    '</div> ' +
                                    '<div class="tb-cell text-right" style="width: 28px;"><span class="iconfont icon-you"></span></div> ' + '</div> ' + '</a>';
                        });
                        $("#scrollList").html(html);
                    }
                }else if(result.status == 'F'){
                    html = '<div class="norecord"> <img src="/assets/meeting/images/nomeeting.png"/> <p class="text-gray">无相关会议室</p> </div>';
                    $("#scrollList").html(html);
                }
            }
        });
    })

    $(document).on('click', '.detail', function () {
        var basic_id = $(this).data('basic_id');
        $(this).toggleClass('detailmsg-show').siblings().removeClass('detailmsg-show');
        $.ajax({
            url : '/meeting/MeetingService/meetingServiceDetail/account_id/{BEESCRM:$accountId}',
            type : 'post',
            data : {basic_id : basic_id},
            dataType : 'json',
            success : function (result) {
                var html = '';
                if(result.status == 'S'){
                    if(result.message){
                        $.each(result.message, function (key, value) {
                            if(key == 'facilities'){
                                html += '<p>'+ '设施设备：' + value.service_item +'</p> ';
                            }else if(key == 'property'){
                                html += '<p>'+ '物业服务：' + value.service_item +'</p> ';
                            }else if(key == 'other'){
                                html += '<p>'+ '其他：' + value.service_item +'</p> ';
                            }
                        })
                    }
                    if(result.basicInfo.remark_text == '' || result.basicInfo.remark_text == null){
                        html += '<p>预约备注：暂无预约备注</p>';
                    }else{
                        html += '<p>' + '预约备注：' + result.basicInfo.remark_text + '</p>';
                    }
                    if(result.basicInfo.note_content == ''){
                        html += '<p>服务备注：暂无服务备注</p>';
                    }else{
                        html += '<p>' + '服务备注：' + result.basicInfo.note_content + '</p>';
                    }
                    $('.detailmsg-show .detailmsg').html(html);
                }else if(result.status == 'F'){

                }
            }
        });
    })
</script>
</body>
</html>